﻿using NUnit.Framework;
using SharpRomans.ParsingRules;
using SharpRomans.Tests.ParsingRules.Support;

namespace SharpRomans.Tests.ParsingRules
{
	[TestFixture]
	public class ZeroTester : RuleTesterBase
	{
		[Test]
		public void SingleZero_NoException()
		{
			string literal = "N";

			Assert.That(() => Observe<Zero>(literal), Throws.Nothing);
		}

		[Test]
		public void MultipleNonZero_NoException()
		{
			string literal = "XLI";

			Assert.That(() => Observe<Zero>(literal), Throws.Nothing);
		}

		[Test]
		public void ZeroIsNotFirst_Exception()
		{
			string literal = "XNL";

			Assert.That(() => Observe<Zero>(literal),
				ThrowsWhenParsing(literal, 1));
		}

		[Test]
		public void ZeroIsNotTheOnlyOne_Exception()
		{
			string literal = "NL";

			Assert.That(() => Observe<Zero>(literal),
				ThrowsWhenParsing(literal, 1));
		}
	}
}
